﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using blackhouse.BlackApart.Business.Reservations;
using blackhouse.BlackApart.Data;

namespace blackhouse.BlackApart.Business.ApartmentServices {
    public class ReservationAdditionalServicePerPerson : DaReservationAdditionalService {

        #region Constuctors

        public ReservationAdditionalServicePerPerson(IWebReservation reservation, IAdditionalService service, IAdditionalServiceDataAccess dataAccess)
            : base(reservation, service, dataAccess) { }

        #endregion

        #region Methods

        public override void BookService() {
            int persons = this.reservation.PersonCount;
            DateTime st = this.reservation.ArrivalDate.Date;
            DateTime et = this.reservation.DepartureDate.AddDays(-1).Date;
            if (this.Service.ServiceTime == ServiceTime.Morning) {
                st = st.AddDays(1);
                et = et.AddDays(1);
            }
            while (st <= et) {
                this.AddServiceForDay(st, persons);
                st = st.AddDays(1);
            }
        }

        public void BookService(DateTime forDay,int apartmentId, int count) {
            this.AddServiceForDay(forDay, count);
        }

        #endregion

    }
}
